#pragma once

#include "IDatabase.h"
#include "IResultSetMetaData.h"

LIBDBC_BEGIN_NAMESPACE

class SqlResult
{
public:
	SqlResult();
	~SqlResult();

	virtual void setConnection(IDatabase* con);
	virtual unsigned int getColumnCount();   
	virtual IResultSetMetaData* getResultSetMetaData();
	virtual char* getFieldName(int field, char* buffer, int len);

	virtual bool next();
	virtual int getInt(int field);
	virtual long getLong(int field);
	virtual double getDouble(int field);
	virtual char* getString(int field, char* buffer, int len);

	virtual const char* getFieldTypeName(int field);
	virtual DBCFieldType getFieldType(int field);

	virtual bool getInt(int field, int* pvalue);
	virtual bool getLong(int field, long* pvalue);
	virtual bool getDouble(int field, double* pvalue);
	virtual bool getStringExt(int field, char* buffer, int len);

	virtual bool getBinaryLength(int field, unsigned long* len);
	virtual bool getBinary(int field, unsigned char* pBuffer, int buflen);

	virtual int getLastErrorCode();

protected:
	int _errorcode;
	IDatabase *_connection;
	IResultSetMetaData *_metaData;

};

LIBDBC_END_NAMESPACE

